Re: [GENERAL] Length of field names. - Mailing list pgsql-general
From | Stuart Rison |
---|---|
Subject | Re: [GENERAL] Length of field names. |
Date | |
Msg-id | l03110706b1cff972b391@[128.40.242.190] Whole thread Raw |
In response to | Re: [GENERAL] Length of field names. (Bruce Momjian <maillist@candle.pha.pa.us>) |
Responses |
Re: [GENERAL] Length of field names.
(Bruce Momjian <maillist@candle.pha.pa.us>)
|
List | pgsql-general |
>> So my guess is that with the original name, malignant_pathologies_invasive >> and the primary key created by it (normally >> malignant_pathologies_invasive_pkey) end up having the same name because of >> the cut-off? >> >> Does this seem right? If so, what is the max length of field names and can >> anyone suggest a way around this problem (obviously I could just give the >> tables shorter names but they are computer generated by a Perl script and >> if at all possible, I'd like to keep the filed and table names in this long >> format). > >max length is 31. > >> PS. For those that have been following the \dt <regex> discussion, in this >> case I would have like a '\d \dt' kind of query to get PG to give me the >> type and length of the Field field (which is more of an SQL query type of >> question so probably would have required SQL access to catalog tables as >> Herouth suggested). > >Huh? Doesn't \d \dt do that if you supply the table name? Yeah I guess I didn't explain that very well. Suppose you did \d test you'd get Field | Type | Length ------------------------------ blah | text | var number | int2 | 2 code | char() | 15 [hand-made table :)] now what is was -badly- trying to say was that is you did a \d of that table you'd get: Field | Type | Length ----------------------------------- Field | varchar() | 31 Type | varchar() | 10 Length | int2 | 2 [or something like that, I'm guessing the numbers/types] so a sort of \d on a \d which would have given me the max length of field. If I understood Herouth's mail properly, all this information (i.e. catalog table) are store as 'hidden' tables in the DBMS. In Oracle it appears these are actually 'usable' in SQL statements -if you know their names and he was suggesting that the same could be of postgreSQL (I'm sorry if I got that all wrong Herouth). cheers, Stuart. PS. That leaves me with giving tables and fields smaller names... I suppose names of over 31 are pretty silly anyway... no wonder I keep exceeding the query buffer!! +-------------------------+--------------------------------------+ | Stuart Rison | Ludwig Institute for Cancer Research | | Tel. (0171) 878 4041 | Courtauld Building | | Fax. (0171) 878 4040 | 91 Riding House Street | +-------------------------+ London, W1P 8BT | | stuart@ludwig.ucl.ac.uk | UNITED KINGDOM. | +-------------------------+--------------------------------------+
pgsql-general by date: